'use strict';
const BaseService = require('./base');

class EnterpriseService extends BaseService {
  constructor(ctx) {
    super(ctx, 'LibraryAreas');
  }
  async getPage(where, page, pageSize) {
    return this.ctx.model.LibraryAreas.findAndCountAll({
      where,
      offset: pageSize * (page - 1),
      limit: pageSize,
      order: this.pageOrder(),
      include: [
        {
          model: this.ctx.model.Libraries,
          as: 'library',
        },
        {
          model: this.ctx.model.LibraryFloors,
          as: 'floor',
        }
      ]
    });
  }

}

module.exports = EnterpriseService;
